import { Entity , PrimaryGeneratedColumn , Column , CreateDateColumn , UpdateDateColumn , OneToOne, JoinColumn , OneToMany , ManyToOne } from 'typeorm';
import { NoteDetail } from './note_detail';
import { NoteEnum } from './note_enum';
import { NoteOwnType } from './note_own_type';
import { User } from './user';
import { TodoDetail } from './todo_detail';

@Entity()
class MemoLists {

    @PrimaryGeneratedColumn()
    id: number;

    @Column({
        type: "varchar",
        length: 255,
        nullable: false,
    })
    title: string;

    @Column({
        type: "varchar",
        length: 255,
        nullable: false,
    })
    created_timestamp: string;

    @Column({
        type: "varchar",
        length: 255,
        nullable: false,
    })
    modified_timestamp: string;

    @Column({
        type: "varchar",
        length: 255,
        nullable: false,
    })
    summary: string;

    @OneToOne(type => NoteDetail,noteDetail => noteDetail.id)
    @JoinColumn()
    noteDetail: NoteDetail;

    @ManyToOne(type => NoteEnum,noteEnum => noteEnum.id)
    noteEnum: NoteEnum;

    @ManyToOne(type => NoteOwnType,noteOwnType => noteOwnType.id)
    noteOwnType: NoteOwnType;

    @ManyToOne(type => User,user => user.id)
    user: User;

    @OneToMany(type => TodoDetail,todo_detail => todo_detail.memoLists)
    todo_details: TodoDetail[]
}

export { MemoLists }